package com.example.demo.controller;


import com.example.demo.model.result;
import com.example.demo.services.ContentShowService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/Readcontent")
public class ContentShowController {

    @Autowired
    private ContentShowService contentShowService;



    private Logger logger= LoggerFactory.getLogger(this.getClass());

    @GetMapping("/getRead")
    public result getRead() {
        logger.info("用户查看所有文章");
        return result.success(contentShowService.selectAll());
    }


    @GetMapping("/getPinglun")
    public result getPinglun(Integer pid){
        logger.info("用户正在查看{}文章",pid);
        return result.success(contentShowService.getWenzhang(pid));
    }


}
